    

<cfset listEvent = viewstate.getValue("myself") & viewstate.getValue("xe.list")  />
<cfset eventRecord = viewstate.getValue("eventRecord") />
<cfset keyString = "&eventID=#urlEncodedFormat(eventRecord.geteventID())#" />
<cfset commitEvent = viewstate.getValue("myself") & viewstate.getValue("xe.commit") & keyString />
<cfset validation = viewstate.getValue("eventValidation", structNew()) />

<cfset isNew = true />
		

		<cfif (not isNumeric(eventRecord.geteventID()) and len(eventRecord.geteventID())) or (isNumeric(eventRecord.geteventID()) and eventRecord.geteventID())>
			<cfset isNew = false />
		</cfif>
	
		
<cfoutput>
<div id="breadcrumb">
		<a href="#listEvent#">Events</a> / 
		<cfif isNew>
			Add New Event
		<cfelse>
			#eventRecord.geteventID()#
		</cfif>
</div>
</cfoutput>
<br />


								
<cfform action="#commitEvent#" class="edit">
    
<fieldset>
    

    <cfoutput>
    <input type="hidden" name="eventID" value="#eventRecord.geteventID()#" />
    </cfoutput>
  
        <div class="formfield">
	        <label for="eventTypeId" <cfif structKeyExists(validation, "eventtype")>class="error"</cfif>><b>Eventtype:</b>
	        </label>
	        <cfset valueQuery = viewstate.getValue("eventtypeList") />
	        <div>
        
          <select name="eventTypeId" id="eventTypeId" >
            
            <cfoutput query="valueQuery">
              <option value="#valueQuery.eventTypeId#" <cfif eventRecord.geteventTypeId() eq valueQuery.eventTypeId>selected</cfif>>#valueQuery.eventTypeName#</option>
            </cfoutput>
          </select>
	        </div>
	        <cfmodule template="/ModelGlue/customtags/validationErrors.cfm" property="eventtype" validation="#validation#" />
        </div>
      
        <div class="formfield">
        	<label <cfif structKeyExists(validation, "eventDateTime")>class="error"</cfif>><b>Event Date Time(s):</b></label>
          <cfset valueQuery = viewstate.getValue("eventDateTimeList") />
          <cfset selectedQuery = eventRecord.geteventDateTimeIterator().getQuery() />

          <cfif viewstate.exists("eventDateTime|eventDateTimeId")>
            <cfset selectedList = viewstate.getValue("eventDateTime|eventDateTimeId") />
          <cfelse>
            <cfset selectedList = valueList(selectedQuery.eventDateTimeId) />
          </cfif>
            
          <!--- 
            hidden makes the field always defined.  if this wasn't here, and you deleted this whole field
            from the control, you'd wind up deleting all child records during a genericCommit...
          --->
          <input type="hidden" name="eventDateTime|eventDateTimeId" value="" />
	        <div class="formfieldinputstack">
          <cfoutput query="valueQuery">
            <label for="eventDateTime_#valueQuery.eventDateTimeId#"><input type="checkbox" name="eventDateTime|eventDateTimeId" id="eventDateTime_#valueQuery.eventDateTimeId#" value="#valueQuery.eventDateTimeId#"<cfif listFindNoCase(selectedList, "#valueQuery.eventDateTimeId#")> checked</cfif>/>#valueQuery.eventDateTimeId#</label><br />
          </cfoutput>
	        </div>
        </div>
          
      
<cfoutput>
<div class="controls">
 	<input type="submit" value="Save" />
  <input type="button" value="Cancel" onclick="document.location.replace('#listEvent#')" />
</div>
</cfoutput>
</fieldset>
</cfform>
    
	
